
var Screen = function(){
	this.people = new Array();
	this.album = new Array();
	this.group = new Array();
	
	this.leftImage = new Array();
	this.selected = new Array();
	this.type = new Array();
	this.particles = new Array();
	
	this.name = new Array();
	this.info = new Array();
	this.network = new Array();
	this.homeTown = new Array();
	this.status = new Array();
	this.interestedIn = new Array();
	
	
	this.current = 0;
	this.max = 3;
}

Screen.prototype.addPeople = function(node, nodeID){
	this.people.push(new People(node), nodeID);
}

Screen.prototype.addAlbum = function(node, nodeID){
	this.album.push(new Album(node), nodeID);
}

Screen.prototype.addGroup = function(node, nodeID){
	this.group.push(new Group(node), nodeID);
}

Screen.prototype.add = function(id, p, particle){
	if(this.current < this.max){
		if(this.search(id) != -1){
			return false;
		}			
		this.selected[this.current] = id;
		this.type[this.current] = p;
		this.particles[this.current] = particle;
		this.current++;
		return true;
	}
	else
		return false;
}

Screen.prototype.search = function(id){
	for(var i = 0; i < this.current; i++){
		if(this.selected[i] == id)
			return i;
	}	
	return -1;
}

Screen.prototype.remove = function(id){
	if(this.search(id) != -1){
		for(var i = this.search(id); i < this.selected.length - 1; i++){
			this.selected[i] = this.selected[i+1];
			this.type[i] = this.type[i+1];
			this.particles[i] = this.particles[i+1];
			this.leftImage[i] = this.leftImage[i+1];
			this.network[i] = this.network[i+1];
			this.homeTown[i] = this.homeTown[i+1];
			this.status[i] = this.status[i+1];
			this.interestedIn[i] = this.leftImage[i+1];
			this.name[i] = this.name[i+1];
			this.info[i] = this.info[i+1];
		}
		this.selected.pop();
		this.type.pop();
		this.leftImage.pop();
		this.network.pop();
		this.homeTown.pop();
		this.status.pop();
		this.interestedIn.pop();
		this.name.pop();
		this.info.pop();
		this.current--;
		return true;
	}
	return false;
}

Screen.prototype.removeAll = function(view, layout){
	var cur = this.current;
	for(var i = 0; i < cur; i++){
		view.changeNormalPic(layout.model.particles[this.particles[0]], this, 0);
		this.remove(this.selected[0]);
	}
}


var People = function(node , nodeID){
	this.nodeID = nodeID;
	this.node = node;
}

var Group = function(node , nodeID){
	this.nodeID = nodeID;
	this.node = node;
}

var Album = function(node , nodeID){
	this.nodeID = nodeID;
	this.node = node;
}








